<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>项目产品报价方案</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<script type="text/javascript">
    var id = '${id}';
    var data = '${listPage}';
    var isClx = '${isClx}';
    var isCumtomerPay = '${isCumtomerPay}';
    var cumtomerPayId = '${cumtomerPayId}';
    var sid = '${sid}';
    var grid = null;
    var shFlag = '${shFlag}';
    var zfFlag = '${zfFlag}';
    var rowArray=[]; //移除行集合 REQ-7326  外部机构资产包管理-屏蔽部分信息 厂商贴息金额”和“供应商返利 by gengchunlan
    var rfbase ='${rfbase}';//外部机构资产包标识 REQ-7326
    console.log("shFlag:" + shFlag);
    $(function () {
        initGrid();//grid
        
        $("#clxSch").hide();
    	if(isClx == 1||isCumtomerPay==1){
    		$("#clxSch").show();	
    	}
    	$("#clxSch").click(function(event){
    		prjId=$("#prjId").val();
    		prjPrdDtlId = $("#prjPrdDtlId").val();
    		prjPrdId = $("#prjPrdId").val();
    		
    		if(null==sid){
    			sid = "";
    		}
    		if(cumtomerPayId){
    		Add_navTab('tab_prj_quat_prps_s'+cumtomerPayId,'查看还款情况','<%=path%>/project/prjprdpayschm/toPrjPrdPaySchMDetailPage.do?id='+cumtomerPayId);
    		}else{
    		Add_navTab('tab_prj_quat_prps_t_s'+sid,'查看还款情况','<%=path%>/project/prjPrdPaySchTM/toPrjPrdPaySchMDetailPage.do?id='+sid);
    		}
    	});
        /*
         *1.启用赎回支付表,隐藏还款情况按钮(支付表管理)
         *2.隐藏还款情况按钮(资管支付表管理)
         */
        if("SH" == shFlag || "true" == zfFlag){
            $("#clxSch").hide();
        }
    });

    //初始化列表
    function initGrid() {
        var params = {};
        $("#grid").ligerGrid({
            data: JsonUtils.parse('${listPage}'),
            columns: [
                {
                    display: '期数', name: 'payPd', minWidth: 140,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        if (value != 0) {
                            h = value;
                        }
                        return h;
                    }
                },
                {
                    display: '应收类型', name: 'feeTypCdNm', minWidth: 200,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        if (rowdata.payPd != 0) {
                            h += "第" + rowdata.payPd + "期" + value;
                        } else {
                            h = value;
                        }
                        return h;
                    },
                    enabledSort: true
                },
                {display: '应还款时间', name: 'payDt', minWidth: 140, render: renderDate, enabledSort: true},
                {display: '应收款合计', name: 'feeAmt', minWidth: 80, enabledSort: true},
                {
                    display: '实际付款合计', name: 'paidUpAmt', minWidth: 80,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        if (null != value && value != "") {
                            var feeTypCd = rowdata.feeTypCd;
                            h = '<a href="javascript:showRepaymentDetail(' + id + ',' + rowdata.payPd + ','+'\''+ feeTypCd.toString()+'\'' + ',' + rowdata.id + ')"' + 'class="link">' + value / 100 + '</a>';
                        }
                        return h;
                    },
                    enabledSort: true
                }
            ],
            //REQ-7326 外部机构资产包管理-屏蔽部分信息 厂商贴息金额”和“供应商返利
            <c:if test="${rfbase == '101'}"> 
			    frozenRownumbers:false,
		            rowAttrRender: function (rowdata,rowid){
		                if (rowdata.feeTypCd=='08' || rowdata.feeTypCd=='52'){
		                	rowArray.push(rowdata);
		             	   return "style='display:none;'";
		               }
		             return "";
		           },
		   </c:if> //end  REQ-7326   
            pageSize: 100,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            allowUnSelectRow: true,
            alternatingRow: false,
            rownumbers: true,
            enabledEdit: false,
            usePagerOnLessPagesize: false,
        });
        grid = liger.get("grid");
        grid.setHeight(500);
        if(rfbase!=null && '101'==rfbase){//移除行集合 REQ-7326  外部机构资产包管理-屏蔽部分信息 厂商贴息金额”和“供应商返利 by gengchunlan
        	if(rowArray!=null && rowArray.length != 0){
        		var manager = $("#grid").ligerGetGridManager();
             	manager.deleteRange(rowArray);
       	  	} 
        }//end by gengchunlan
    }
    //格式化为人民币格式
    function renderAmt(rowdata, rowindex, value) {
        var h = "￥" + FormatMoney(value)
        return h;
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value && value != '') {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }


    function iframeResize() {
        if (parent.mainApp) {
            parent.mainApp.parentTab.onResize();
        }
        ;
    }

    function showRepaymentDetail(paySchId, payPd,feeTypCd, payDetailId) {
        var onCancel = function (item, Dialog) {
            Dialog.hide();
        };
        $.ligerDialog.SQopen({
            width: 850,
            height: 500,
            title: '还款明细',
            url: '<%=path%>/capital/capPayInfo/toRepaymentDtl.do?paySchId=' + paySchId + "&payPd=" + payPd +"&feeTypCd="+feeTypCd +"&payDetailId="+payDetailId,
            buttons: [
                {
                    text: "关闭", onclick: onCancel, type: 'cancel'
                }
            ]
        });
    }
</script>

<body class="iframeBody">
<div class="Wrapper">
    <div>
        <div id="pageInTab" class="pageInTab">
        <div tabid="tabA" title="基本信息" lselected="true">
			<div style="text-align:right">
				<span id="clxSch" class="sq-button"><a>还款情况</a></span>
			</div>
            <form id="formSet1">
                <div class="fieldset1 tabel_col clearFix">
                    <div id="grid" class="sq-grid"></div>
                    <div>
                        <div class="fieldBox col_33">
                            <div class="label">合计实收：</div>
                            <div class="field">
                                <span>${totalRntAmt}</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">合计实付：</div>
                            <div class="field">
                                <span>${totalPardUpAmt}</span>
                            </div>
                        </div>
                        <div class="caption">
                            <span class="title">罚息</span>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">总罚息金额：</div>
                            <div class="field">
                                <span>${cap.overdueAmount}</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">实付罚息金额：</div>
                            <div class="field">
                                <span>${cap.penaltyAmount}</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">减免罚息金额：</div>
                            <div class="field">
                                <span>${cap.reduAmount}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>